#!/usr/bin/env python
# -*- coding:utf-8 -*-
# @FileName  :tmall_comment.py
# @Time      :2023/11/16 
# @Author    :CL
# @email     :1037654919@qq.com
import re
import time
import jieba
from utils import  mongo_manager
import pandas as pd
tmall_comment_test = mongo_manager('tmall_comment_test',db = 'public_data')

comment3 = {
    "api": "mtop.alibaba.review.list.for.new.pc.detail",
    "data": {
        "module": {
            "foldFlagCount": "351",
            "hasNext": "true",
            "reviewVOList": [{
                "allowInteract": "true",
                "buyCreditLevelPic": "https://img.alicdn.com/imgextra/i4/O1CN01ZlCYMx1nbVriw6u0S_!!6000000005108-2-tps-92-45.png",
                "headPicUrl": "http://img.alicdn.com/tps/TB1l6dkOXXXXXXEXVXXXXXXXXXX-210-210.png_70x70.jpg",
                "id": "1223431747952",
                "interactionVO": {
                    "alreadyLike": "false",
                    "commentCount": "0",
                    "likeCount": "0",
                    "opinionCount": "0",
                    "readCount": "11",
                    "reviewId": "1223431747952"
                },
                "reply": "",
                "reviewDate": "7天前",
                "reviewPicPathList": ["//img.alicdn.com/imgextra/i1/O1CN01wKiNKq1bevYlvMxVU_!!0-tbbala.jpg", "//img.alicdn.com/imgextra/i2/O1CN01yFZFnT1bevYqZnlkl_!!0-tbbala.jpg", "//img.alicdn.com/imgextra/i2/O1CN01HJ4FGW1bevYqa1Gav_!!0-tbbala.jpg"],
                "reviewWordContent": "箱子很时尚男朋友非常喜欢，出差还是很方便的就是容量有点小",
                "skuText": {
                    "尺寸": "20寸",
                    "颜色分类": "银色 智慧版 可登机"
                },
                "userNick": "烁**堡",
                "videoVOList": []
            }, {
                "allowInteract": "true",
                "buyCreditLevelPic": "https://img.alicdn.com/imgextra/i3/O1CN01PIYxrZ22FGrmiDphN_!!6000000007090-2-tps-92-45.png",
                "headPicUrl": "http://sns.m.taobao.com/avatar/sns/user/flag/sns_logo?type=taobao&kn=wwc_tb_11&bizCode=taobao_avatar&userFlag=RAzN83923zmuymBLAtrpyBsXmvE7xFTBhARzSE7BjLzvNPMtygtL91rJ3zgGNaPyKAGMciV6L1Fqje17gq5MXeXi4zoHVCgRXRobWupCnxNkSPLfEzss3ZjpsRrw",
                "id": "1222551693419",
                "interactionVO": {
                    "alreadyLike": "false",
                    "commentCount": "0",
                    "likeCount": "0",
                    "opinionCount": "0",
                    "readCount": "39",
                    "reviewId": "1222551693419"
                },
                "reply": "",
                "reviewDate": "12天前",
                "reviewPicPathList": ["//img.alicdn.com/imgextra/i4/O1CN01RZT19B1QcDRUGc3FI_!!0-rate.jpg", "//img.alicdn.com/imgextra/i1/O1CN01zGv6uW1QcDROExXtb_!!0-rate.jpg", "//img.alicdn.com/imgextra/i4/O1CN01NSq4v31QcDRPF6XZ1_!!0-rate.jpg"],
                "reviewWordContent": "全家都试了，妈妈说质感挺好。操作简单，灵活，使用方便。全家都喜欢。开心！",
                "skuText": {
                    "尺寸": "20寸",
                    "颜色分类": "智慧版+备用电池 箱子颜色可备注"
                },
                "userNick": "c**8",
                "videoVOList": []
            }, {
                "allowInteract": "true",
                "buyCreditLevelPic": "https://img.alicdn.com/imgextra/i1/O1CN01phm4Vd24PvJPU1Vhb_!!6000000007384-2-tps-92-45.png",
                "headPicUrl": "http://img.alicdn.com/tps/TB1l6dkOXXXXXXEXVXXXXXXXXXX-210-210.png_70x70.jpg",
                "id": "1219054357811",
                "interactionVO": {
                    "alreadyLike": "false",
                    "commentCount": "0",
                    "likeCount": "5",
                    "opinionCount": "0",
                    "readCount": "370",
                    "reviewId": "1219054357811"
                },
                "reply": "",
                "reviewDate": "1个月前",
                "reviewPicPathList": ["//img.alicdn.com/imgextra/i2/O1CN01dmVY9x21Ftubpo9Y0_!!0-tbbala.jpg", "//img.alicdn.com/imgextra/i3/O1CN01JHIR2021FtugSC7fT_!!0-tbbala.jpg", "//img.alicdn.com/imgextra/i3/O1CN01HRCI0u21FtugSBJkv_!!0-tbbala.jpg"],
                "reviewWordContent": "看到机场有人在用，孩子出行就它了，十一去旅游，带着感觉一下",
                "skuText": {
                    "尺寸": "20寸",
                    "颜色分类": "银色 智慧版 可登机"
                },
                "userNick": "安**使",
                "videoVOList": [{
                    "attributesMap": {},
                    "coverUrl": "//img.alicdn.com/imgextra/i1/O1CN01rO3vE321FtuiEtHQs_!!0-tbbala.jpg",
                    "sourceUrl": "http://pingjia.alicdn.com//img.alicdn.com/imgextra/i1/O1CN01rO3vE321FtuiEtHQs_!!0-tbbala.jpg",
                    "status": "1",
                    "url": "http://cloud.video.taobao.com/play/u/null/p/1/d/hd/e/6/t/1/428757320676.mp4",
                    "videoId": "428757320676"
                }]
            }, {
                "allowInteract": "true",
                "buyCreditLevelPic": "https://img.alicdn.com/imgextra/i4/O1CN019QZnaG1U1LtUAPn6e_!!6000000002457-2-tps-92-45.png",
                "headPicUrl": "http://sns.m.taobao.com/avatar/sns/user/flag/sns_logo?type=taobao&kn=wwc_tb_11&bizCode=taobao_avatar&userFlag=RAzN84GK7wS8eP6xBMxbVifdmX6fqstzkb75QfAW4NrogwiXW3itoVeM6LBpWC6j2A4x5eHYcSqL9FxMFAHeDeCAtNknpobfxY9KuR8sE9UP3RZwjeotrGh9Q8maWGrDEfyVSCir2UTA35Mr1BHWqBiyhbcAVbRDyYk4DAR",
                "id": "1220273252405",
                "interactionVO": {
                    "alreadyLike": "false",
                    "commentCount": "0",
                    "likeCount": "0",
                    "opinionCount": "0",
                    "readCount": "463",
                    "reviewId": "1220273252405"
                },
                "reply": "",
                "reviewDate": "1个月前",
                "reviewPicPathList": ["//img.alicdn.com/imgextra/i2/O1CN01gdaeXW1JVcQ1FlG1j_!!0-tbbala.jpg", "//img.alicdn.com/imgextra/i1/O1CN01yqpxGT1JVcQ1FjqjX_!!0-tbbala.jpg", "//img.alicdn.com/imgextra/i4/O1CN01uru16V1JVcQ3FWSft_!!0-tbbala.jpg", "//img.alicdn.com/imgextra/i2/O1CN01anFwe51JVcQ1Fkedg_!!0-tbbala.jpg"],
                "reviewWordContent": "质量真的是没坏说，买给女儿用的，自己试了一下，速度也很快，真的很好！",
                "skuText": {
                    "尺寸": "20寸",
                    "颜色分类": "智慧版+备用电池 箱子颜色可备注"
                },
                "userNick": "t**5",
                "videoVOList": []
            }, {
                "allowInteract": "true",
                "buyCreditLevelPic": "https://img.alicdn.com/imgextra/i1/O1CN01phm4Vd24PvJPU1Vhb_!!6000000007384-2-tps-92-45.png",
                "headPicUrl": "http://img.alicdn.com/tps/TB1l6dkOXXXXXXEXVXXXXXXXXXX-210-210.png_70x70.jpg",
                "id": "1222673937034",
                "interactionVO": {
                    "alreadyLike": "false",
                    "commentCount": "0",
                    "likeCount": "0",
                    "opinionCount": "0",
                    "readCount": "36",
                    "reviewId": "1222673937034"
                },
                "reply": "",
                "reviewDate": "11天前",
                "reviewPicPathList": ["//img.alicdn.com/imgextra/i4/O1CN01GqxnTO2Cf3S9IE4zD_!!0-tbbala.jpg", "//img.alicdn.com/imgextra/i3/O1CN01Mf9x2X2Cf3SCKU5kB_!!0-tbbala.jpg", "//img.alicdn.com/imgextra/i1/O1CN01SS7YBZ2Cf3SFJvLAh_!!0-tbbala.jpg"],
                "reviewWordContent": "之前朋友买了一个，感觉挺好的，方便，小孩很喜欢，！",
                "skuText": {
                    "尺寸": "20寸",
                    "颜色分类": "粉色 豪华版 可登机"
                },
                "userNick": "w**y",
                "videoVOList": []
            }, {
                "allowInteract": "true",
                "buyCreditLevelPic": "https://img.alicdn.com/imgextra/i3/O1CN01PIYxrZ22FGrmiDphN_!!6000000007090-2-tps-92-45.png",
                "headPicUrl": "http://sns.m.taobao.com/avatar/sns/user/flag/sns_logo?type=taobao&kn=wwc_tb_11&bizCode=taobao_avatar&userFlag=RAzN83923zmuymBLAtrpyBsXmvE7xFTBhARzRop6bXvUc6ysSqmZnbrVtPLLJYD8fB6dx3ePgrFtjJUHKjk6iP8fV8mnWusoG83vZJWDczGecmwUxRc2i8b8YLAh",
                "id": "1223150743673",
                "interactionVO": {
                    "alreadyLike": "false",
                    "commentCount": "0",
                    "likeCount": "0",
                    "opinionCount": "0",
                    "readCount": "29",
                    "reviewId": "1223150743673"
                },
                "reply": "",
                "reviewDate": "10天前",
                "reviewPicPathList": ["//img.alicdn.com/imgextra/i4/O1CN01ZxBmbu21XlNLxCShB_!!0-tbbala.jpg", "//img.alicdn.com/imgextra/i2/O1CN01kZflnA21XlNIxjXJB_!!0-tbbala.jpg", "//img.alicdn.com/imgextra/i4/O1CN01nImD8i21XlNKM21JY_!!0-tbbala.jpg"],
                "reviewWordContent": "做工不错，独特设计，路上很多人来问性能，回头率很高",
                "skuText": {
                    "尺寸": "20寸",
                    "颜色分类": "银色 智慧版 可登机"
                },
                "userNick": "小**e",
                "videoVOList": []
            }, {
                "allowInteract": "true",
                "buyCreditLevelPic": "https://img.alicdn.com/imgextra/i3/O1CN01PIYxrZ22FGrmiDphN_!!6000000007090-2-tps-92-45.png",
                "headPicUrl": "http://sns.m.taobao.com/avatar/sns/user/flag/sns_logo?type=taobao&kn=wwc_tb_11&bizCode=taobao_avatar&userFlag=RAzN83923zmuymBLAtrpyBsXmvE7xFTBhARzTam1RKUrEkAf996CSzonSMkua7szw2kaMFyPXNDw5eJ8HKgfvzcuyBnBFykFriJ1wk6SjnZn4BzzB5kVsqDDu1kG",
                "id": "1219857731697",
                "interactionVO": {
                    "alreadyLike": "false",
                    "commentCount": "0",
                    "likeCount": "1",
                    "opinionCount": "0",
                    "readCount": "1126",
                    "reviewId": "1219857731697"
                },
                "reply": "",
                "reviewAppendVO": {
                    "appendedWordContent": "发货非常快！箱子质量很好，箱子里比想象中大，骑着非常顺畅，快慢都可以调节！不错！",
                    "intervalDay": "0",
                    "reply": "",
                    "reviewPicPathList": ["//img.alicdn.com/imgextra/i4/0/O1CN01JsTRQG1gmK1N57ovK_!!0-tbbala.jpg", "//img.alicdn.com/imgextra/i1/0/O1CN01Z5OzzE1gmK1SfODly_!!0-tbbala.jpg", "//img.alicdn.com/imgextra/i2/0/O1CN01cQRGgB1gmK1JLaw21_!!0-tbbala.jpg"],
                    "videoVOList": []
                },
                "reviewDate": "1个月前",
                "reviewWordContent": "此用户没有填写评价。",
                "skuText": {
                    "尺寸": "20寸",
                    "颜色分类": "智慧版+备用电池 箱子颜色可备注"
                },
                "userNick": "杨**2",
                "videoVOList": []
            }, {
                "allowInteract": "true",
                "buyCreditLevelPic": "https://img.alicdn.com/imgextra/i3/O1CN01PIYxrZ22FGrmiDphN_!!6000000007090-2-tps-92-45.png",
                "headPicUrl": "http://sns.m.taobao.com/avatar/sns/user/flag/sns_logo?type=taobao&kn=wwc_tb_11&bizCode=taobao_avatar&userFlag=RAzN83923zmuymBLAtrpyBsXmvE7xFTBhARzV5nQNQQotVA4S4xfS6AVM18iALtVNX46D8n2BTp31NccAdYUDixJB69YJiBhf9pUhwyxocxhyTZoDdbNF8o6z59i",
                "id": "1222942391986",
                "interactionVO": {
                    "alreadyLike": "false",
                    "commentCount": "0",
                    "likeCount": "0",
                    "opinionCount": "0",
                    "readCount": "12",
                    "reviewId": "1222942391986"
                },
                "reply": "",
                "reviewDate": "12天前",
                "reviewPicPathList": ["//img.alicdn.com/imgextra/i4/O1CN01jtZe8V1NsIV5ImCiN_!!0-rate.jpg", "//img.alicdn.com/imgextra/i1/O1CN01hYqOOk1NsIV6Pwkl1_!!0-rate.jpg", "//img.alicdn.com/imgextra/i1/O1CN01o67IoH1NsIV4IEuWJ_!!0-rate.jpg"],
                "reviewWordContent": "太好了，高科技就是爽，收到货当天就去公园骑了，精致好用，适合懒人，强烈推荐啊！",
                "skuText": {
                    "尺寸": "20寸",
                    "颜色分类": "银色 智慧版 可登机"
                },
                "userNick": "社**7",
                "videoVOList": []
            }, {
                "allowInteract": "true",
                "buyCreditLevelPic": "https://img.alicdn.com/imgextra/i3/O1CN01PIYxrZ22FGrmiDphN_!!6000000007090-2-tps-92-45.png",
                "headPicUrl": "http://img.alicdn.com/tps/TB1l6dkOXXXXXXEXVXXXXXXXXXX-210-210.png_70x70.jpg",
                "id": "1219214114361",
                "interactionVO": {
                    "alreadyLike": "false",
                    "commentCount": "1",
                    "likeCount": "2",
                    "opinionCount": "0",
                    "readCount": "280",
                    "reviewId": "1219214114361"
                },
                "reply": "",
                "reviewDate": "1个月前",
                "reviewPicPathList": ["//img.alicdn.com/imgextra/i1/O1CN01VPNlJU1qmSIAenXhU_!!0-rate.jpg"],
                "reviewWordContent": "很沉啊，怀疑我自己无法举上高处去。箱内容量去掉电机位置后剩的不太多，夏季旅游带着没问题，冬天的话冬装可装不下多少了。但是外观漂亮拉风，沉也意味着箱体结实，速度蛮快的，前进刹车都很灵敏，累了确实可以代步，挺实用的。 ",
                "skuText": {
                    "尺寸": "20寸",
                    "颜色分类": "银色 青春版 可登机"
                },
                "userNick": "小**瞳",
                "videoVOList": []
            }, {
                "allowInteract": "true",
                "buyCreditLevelPic": "https://img.alicdn.com/imgextra/i4/O1CN019QZnaG1U1LtUAPn6e_!!6000000002457-2-tps-92-45.png",
                "headPicUrl": "http://img.alicdn.com/tps/TB1l6dkOXXXXXXEXVXXXXXXXXXX-210-210.png_70x70.jpg",
                "id": "1222356466292",
                "interactionVO": {
                    "alreadyLike": "false",
                    "commentCount": "0",
                    "likeCount": "0",
                    "opinionCount": "0",
                    "readCount": "82",
                    "reviewId": "1222356466292"
                },
                "reply": "",
                "reviewDate": "17天前",
                "reviewPicPathList": ["//img.alicdn.com/imgextra/i3/O1CN01sO0fZZ1wWmRc6zTBw_!!0-tbbala.jpg", "//img.alicdn.com/imgextra/i3/O1CN0105eOJ01wWmRc6xOHR_!!0-tbbala.jpg", "//img.alicdn.com/imgextra/i4/O1CN01hB4ho01wWmRdk4TO2_!!0-tbbala.jpg"],
                "reviewWordContent": "拉杆箱已经收到，使用过了，东西好，发货速度快。会继续关注。",
                "skuText": {
                    "尺寸": "20寸",
                    "颜色分类": "黑色 豪华版 可登机"
                },
                "userNick": "佳**8",
                "videoVOList": []
            }, {
                "allowInteract": "true",
                "buyCreditLevelPic": "https://img.alicdn.com/imgextra/i4/O1CN01ZlCYMx1nbVriw6u0S_!!6000000005108-2-tps-92-45.png",
                "headPicUrl": "http://img.alicdn.com/tps/TB1l6dkOXXXXXXEXVXXXXXXXXXX-210-210.png_70x70.jpg",
                "id": "1221794108476",
                "interactionVO": {
                    "alreadyLike": "false",
                    "commentCount": "0",
                    "likeCount": "0",
                    "opinionCount": "0",
                    "readCount": "73",
                    "reviewId": "1221794108476"
                },
                "reply": "",
                "reviewDate": "17天前",
                "reviewPicPathList": ["//img.alicdn.com/imgextra/i3/O1CN014bkKzQ27C8MWo0gms_!!2-rate.png", "//img.alicdn.com/imgextra/i3/O1CN01fTuJNn27C8MYUE6wn_!!0-rate.jpg"],
                "reviewWordContent": "行李箱大小合适，包装挺严实的，电动的速度还挺快",
                "skuText": {
                    "尺寸": "20寸",
                    "颜色分类": "银色 青春版 可登机"
                },
                "userNick": "t**1",
                "videoVOList": []
            }, {
                "allowInteract": "true",
                "buyCreditLevelPic": "https://img.alicdn.com/imgextra/i1/O1CN01phm4Vd24PvJPU1Vhb_!!6000000007384-2-tps-92-45.png",
                "headPicUrl": "http://img.alicdn.com/tps/TB1l6dkOXXXXXXEXVXXXXXXXXXX-210-210.png_70x70.jpg",
                "id": "1220587646332",
                "interactionVO": {
                    "alreadyLike": "false",
                    "commentCount": "0",
                    "likeCount": "0",
                    "opinionCount": "0",
                    "readCount": "354",
                    "reviewId": "1220587646332"
                },
                "reply": "",
                "reviewDate": "1个月前",
                "reviewPicPathList": ["//img.alicdn.com/imgextra/i1/O1CN011fCw6b1Vyiyd05Ejr_!!0-tbbala.jpg", "//img.alicdn.com/imgextra/i1/O1CN01rMgziF1Vyiyf03WxR_!!0-tbbala.jpg", "//img.alicdn.com/imgextra/i1/O1CN01WZxTvX1VyiyYmnxUb_!!0-tbbala.jpg"],
                "reviewWordContent": "看到某音上推介，毫不犹豫下手了，儿子经常说走不动，我也抱不动，买这个希望能有用！做工不错。",
                "skuText": {
                    "尺寸": "20寸",
                    "颜色分类": "银色青春+备用电池"
                },
                "userNick": "s**3",
                "videoVOList": []
            }, {
                "allowInteract": "true",
                "buyCreditLevelPic": "https://img.alicdn.com/imgextra/i4/O1CN019QZnaG1U1LtUAPn6e_!!6000000002457-2-tps-92-45.png",
                "headPicUrl": "http://sns.m.taobao.com/avatar/sns/user/flag/sns_logo?type=taobao&kn=wwc_tb_11&bizCode=taobao_avatar&userFlag=RAzN83923zmuymBLAtrpyBsXmvE7xFTBhARzR6nLhvDLYzSXUpSaRC37DECDKxppQXpyu9ai9TmptgeaiChyZt5PUmXSnjEAKKTFixqDfvWGFUatm5FtaC4Z7RPi",
                "id": "1217774377678",
                "interactionVO": {
                    "alreadyLike": "false",
                    "commentCount": "0",
                    "likeCount": "2",
                    "opinionCount": "0",
                    "readCount": "1307",
                    "reviewId": "1217774377678"
                },
                "reply": "",
                "reviewDate": "2个月前",
                "reviewPicPathList": ["//img.alicdn.com/imgextra/i1/O1CN01OMMwCp255bT7nWyXO_!!0-tbbala.jpg"],
                "reviewWordContent": "超级实用 老年人的代步工具 可以去公园 商场 医院 不用走路了 尤其膝盖有损伤的更加实用 老妈很喜欢 孝敬父母 ",
                "skuText": {
                    "尺寸": "20寸",
                    "颜色分类": "银色 青春版 可登机"
                },
                "userNick": "刘**豆",
                "videoVOList": [{
                    "attributesMap": {},
                    "coverUrl": "//img.alicdn.com/imgextra/i2/O1CN01XbeMXO255bT5znV3k_!!0-tbbala.jpg",
                    "sourceUrl": "http://pingjia.alicdn.com//img.alicdn.com/imgextra/i2/O1CN01XbeMXO255bT5znV3k_!!0-tbbala.jpg",
                    "status": "1",
                    "url": "http://cloud.video.taobao.com/play/u/null/p/1/d/hd/e/6/t/1/427470751273.mp4",
                    "videoId": "427470751273"
                }]
            }, {
                "allowInteract": "true",
                "buyCreditLevelPic": "https://img.alicdn.com/imgextra/i3/O1CN01PIYxrZ22FGrmiDphN_!!6000000007090-2-tps-92-45.png",
                "headPicUrl": "http://img.alicdn.com/tps/TB1l6dkOXXXXXXEXVXXXXXXXXXX-210-210.png_70x70.jpg",
                "id": "1219866984198",
                "interactionVO": {
                    "alreadyLike": "false",
                    "commentCount": "0",
                    "likeCount": "2",
                    "opinionCount": "0",
                    "readCount": "313",
                    "reviewId": "1219866984198"
                },
                "reply": "",
                "reviewDate": "1个月前",
                "reviewPicPathList": ["//img.alicdn.com/imgextra/i3/O1CN01F4VGWp1mfo5JzVTQK_!!0-tbbala.jpg", "//img.alicdn.com/imgextra/i4/O1CN01NS5Q0B1mfo5NFEE4Q_!!0-tbbala.jpg"],
                "reviewWordContent": "真的很喜欢 尤其是机场大的时候特别容易大展身手 还有很多人找我拍照问",
                "skuText": {
                    "尺寸": "20寸",
                    "颜色分类": "银色 青春版 可登机"
                },
                "userNick": "c**0",
                "videoVOList": []
            }, {
                "allowInteract": "true",
                "buyCreditLevelPic": "https://img.alicdn.com/imgextra/i1/O1CN01Bm9gkz1yASEqBM8xQ_!!6000000006538-2-tps-92-45.png",
                "headPicUrl": "http://sns.m.taobao.com/avatar/sns/user/flag/sns_logo?type=taobao&kn=wwc_tb_11&bizCode=taobao_avatar&userFlag=RAzN84GK7wS8eNdZ9Frk3odYPPoRYjcciyCqiFyop22AYJjZh3KmnE5dJ7nfg2zYsgknkegeYmZ6vc45U1ro2R3agpG5h7UGCauEoDuCp3BSYo9piFd1TbGvCKUD1JkRuWzaJszaZQzAGjXJPbVtwbF4PGvRqoAxKe4vdy3",
                "id": "1221278952188",
                "interactionVO": {
                    "alreadyLike": "false",
                    "commentCount": "0",
                    "likeCount": "0",
                    "opinionCount": "0",
                    "readCount": "116",
                    "reviewId": "1221278952188"
                },
                "reply": "",
                "reviewDate": "23天前",
                "reviewPicPathList": ["//img.alicdn.com/imgextra/i3/O1CN01Trstrv1uc9rNY4Woo_!!0-rate.jpg", "//img.alicdn.com/imgextra/i2/O1CN01acr6Hm1uc9rQeQhqi_!!0-rate.jpg"],
                "reviewWordContent": "质量好物流快.值得推介",
                "skuText": {
                    "尺寸": "20寸",
                    "颜色分类": "黑色 智慧版 可登机"
                },
                "userNick": "小**4",
                "videoVOList": []
            }, {
                "allowInteract": "true",
                "buyCreditLevelPic": "https://img.alicdn.com/imgextra/i3/O1CN01PIYxrZ22FGrmiDphN_!!6000000007090-2-tps-92-45.png",
                "headPicUrl": "http://sns.m.taobao.com/avatar/sns/user/flag/sns_logo?type=taobao&kn=wwc_tb_11&bizCode=taobao_avatar&userFlag=RAzN84GK7wS8eNdZ9Frk3odYPPoRYjcciyCqQtnokftYWoG8dCKDWbtXW27bpHa1Rfwrzm8mLET5r2tegpRumTSra3UcsxCzbPT61B7Ac27ExS2w1S4m1okWkQMzFsBF8uSFNsUvF71phXfxQC9fwM4njDKQcw3uiYQdKPf",
                "id": "1221578217931",
                "interactionVO": {
                    "alreadyLike": "false",
                    "commentCount": "0",
                    "likeCount": "0",
                    "opinionCount": "0",
                    "readCount": "110",
                    "reviewId": "1221578217931"
                },
                "reply": "",
                "reviewDate": "23天前",
                "reviewPicPathList": ["//img.alicdn.com/imgextra/i1/O1CN01jRzkbW29yLHXLhDfz_!!0-tbbala.jpg"],
                "reviewWordContent": "老妈腿脚不便想去旅游 看到这个很合适 问了几次客服能不能上飞机 他们很耐心回答也专业 这下终于能带爸妈去玩了 以后还能给娃用",
                "skuText": {
                    "尺寸": "20寸",
                    "颜色分类": "银色 智慧版 可登机"
                },
                "userNick": "土**4",
                "videoVOList": []
            }, {
                "allowInteract": "true",
                "buyCreditLevelPic": "https://img.alicdn.com/imgextra/i4/O1CN019QZnaG1U1LtUAPn6e_!!6000000002457-2-tps-92-45.png",
                "headPicUrl": "http://img.alicdn.com/tps/TB1l6dkOXXXXXXEXVXXXXXXXXXX-210-210.png_70x70.jpg",
                "id": "1219433894220",
                "interactionVO": {
                    "alreadyLike": "false",
                    "commentCount": "0",
                    "likeCount": "0",
                    "opinionCount": "0",
                    "readCount": "774",
                    "reviewId": "1219433894220"
                },
                "reply": "",
                "reviewDate": "1个月前",
                "reviewPicPathList": ["//img.alicdn.com/imgextra/i1/O1CN01xBQhfI1fqc7IKJ5iU_!!0-tbbala.jpg", "//img.alicdn.com/imgextra/i2/O1CN019o7b0m1fqc7JIJUEU_!!0-tbbala.jpg", "//img.alicdn.com/imgextra/i2/O1CN01ZoTEoq1fqc7HAZlfv_!!0-tbbala.jpg"],
                "reviewWordContent": "款式设计：很新颖 品质做工：很好 容量大小：不大 小朋友很喜欢 第一个自己的旅行箱  ",
                "skuText": {
                    "尺寸": "20寸",
                    "颜色分类": "银色 青春版 可登机"
                },
                "userNick": "r**y",
                "videoVOList": [{
                    "attributesMap": {},
                    "coverUrl": "//img.alicdn.com/imgextra/i1/O1CN01j7EEZS1fqc7CIVOyu_!!0-tbbala.jpg",
                    "sourceUrl": "http://pingjia.alicdn.com//img.alicdn.com/imgextra/i1/O1CN01j7EEZS1fqc7CIVOyu_!!0-tbbala.jpg",
                    "status": "1",
                    "url": "http://cloud.video.taobao.com/play/u/null/p/1/d/hd/e/6/t/1/429599654208.mp4",
                    "videoId": "429599654208"
                }]
            }, {
                "allowInteract": "true",
                "buyCreditLevelPic": "https://img.alicdn.com/imgextra/i4/O1CN01ZlCYMx1nbVriw6u0S_!!6000000005108-2-tps-92-45.png",
                "headPicUrl": "http://sns.m.taobao.com/avatar/sns/user/flag/sns_logo?type=taobao&kn=wwc_tb_11&bizCode=taobao_avatar&userFlag=RAzN84GK7wS8eNNd1sSzCFHEHGfDvibTBKR96xgfBFuL7u5TwsXS6AGzZ1io1Ln44ES5KrmXPaZ5haTYVxYB8u5Yg71qiNW9hNth5FGy68XYpUn75dJLhWpEVyDDoXMfASCB61BXcLpyEWV8U13uQKjJwSCoD58YvDzEayo",
                "id": "1215947481992",
                "interactionVO": {
                    "alreadyLike": "false",
                    "commentCount": "5",
                    "likeCount": "15",
                    "opinionCount": "0",
                    "readCount": "12437",
                    "reviewId": "1215947481992"
                },
                "reply": "",
                "reviewDate": "2个月前",
                "reviewPicPathList": ["//img.alicdn.com/imgextra/i1/O1CN01HlNtna2JVABWd4Vsm_!!0-tbbala.jpg", "//img.alicdn.com/imgextra/i3/O1CN01FpBWXV2JVABWfYzXa_!!0-tbbala.jpg", "//img.alicdn.com/imgextra/i1/O1CN01LfVeuR2JVABUcydok_!!0-tbbala.jpg", "//img.alicdn.com/imgextra/i3/O1CN01NgDy4k2JVABO9xoib_!!0-tbbala.jpg", "//img.alicdn.com/imgextra/i2/O1CN01UaYN3S2JVABXvmSPb_!!0-tbbala.jpg"],
                "reviewWordContent": "我亲爱的爹地在出差路上看到有人骑这个行李箱上路 说我的女儿也应该有一个 于是我就收到啦 骑上去比想象中稳很多 在室内骑很丝滑 但是在马上路上也很不错啦 有点小颠 但是是在可接受范围内 行李箱空间也比想象中大很多 总体来说物有所值噜",
                "skuText": {
                    "尺寸": "20寸",
                    "颜色分类": "黑色 智慧版 可登机"
                },
                "userNick": "发**货",
                "videoVOList": []
            }, {
                "allowInteract": "true",
                "buyCreditLevelPic": "https://img.alicdn.com/imgextra/i4/O1CN01ZlCYMx1nbVriw6u0S_!!6000000005108-2-tps-92-45.png",
                "headPicUrl": "http://sns.m.taobao.com/avatar/sns/user/flag/sns_logo?type=taobao&kn=wwc_tb_11&bizCode=taobao_avatar&userFlag=RAzN84GK7wS8eNdZ9Frk3odYPPoRYjcciyCrYv6R7fVjCYs1PzShdFxPWrTU17XgDKbXugdRMHyrKZ7yMS16fawkbtkU4CFkN65zjaChFwtM7ZVnueqjSAb3qHnBBgPBVybESs7muCCPMhzkTueNzE8ZJy5NVh8mRfXBA9P",
                "id": "1218010804202",
                "interactionVO": {
                    "alreadyLike": "false",
                    "commentCount": "0",
                    "likeCount": "1",
                    "opinionCount": "0",
                    "readCount": "352",
                    "reviewId": "1218010804202"
                },
                "reply": "",
                "reviewDate": "2个月前",
                "reviewPicPathList": ["//img.alicdn.com/imgextra/i4/O1CN01L501Cw1MA2b4Rxh2I_!!0-rate.jpg", "//img.alicdn.com/imgextra/i4/O1CN01EYdFyo1MA2bCwrWs1_!!0-rate.jpg", "//img.alicdn.com/imgextra/i1/O1CN01GpKn9T1MA2bBG1AWf_!!0-rate.jpg"],
                "reviewWordContent": "面料外形都还不错，坐上去行驶也很平稳，比较灵活，孩子很喜欢",
                "skuText": {
                    "尺寸": "20寸",
                    "颜色分类": "银色 豪华版 可登机"
                },
                "userNick": "f**5",
                "videoVOList": []
            }, {
                "allowInteract": "true",
                "buyCreditLevelPic": "https://img.alicdn.com/imgextra/i3/O1CN01PIYxrZ22FGrmiDphN_!!6000000007090-2-tps-92-45.png",
                "headPicUrl": "http://img.alicdn.com/tps/TB1l6dkOXXXXXXEXVXXXXXXXXXX-210-210.png_70x70.jpg",
                "id": "1218539086845",
                "interactionVO": {
                    "alreadyLike": "false",
                    "commentCount": "1",
                    "likeCount": "0",
                    "opinionCount": "0",
                    "readCount": "394",
                    "reviewId": "1218539086845"
                },
                "reply": "",
                "reviewDate": "2个月前",
                "reviewPicPathList": ["//img.alicdn.com/imgextra/i2/O1CN01affucR1ieecRexJkk_!!0-rate.jpg", "//img.alicdn.com/imgextra/i3/O1CN01nmcbj41ieecLuAR5b_!!0-rate.jpg"],
                "reviewWordContent": "买了两个  一个银色一个粉色  喜欢的不得了 轮子也挺静音的 ",
                "skuText": {
                    "尺寸": "20寸",
                    "颜色分类": "银色 豪华版 可登机"
                },
                "userNick": "兔**1",
                "videoVOList": []
            }]
        }
    },
    "ret": ["SUCCESS::调用成功"],
    "v": "1.0"
}




import requests


headers = {
    "authority": "h5api.m.tmall.com",
    "accept": "*/*",
    "accept-language": "zh-CN,zh;q=0.9",
    "cache-control": "no-cache",
    "pragma": "no-cache",
    "referer": "https://detail.tmall.com/",
    "sec-ch-ua": "\"Not.A/Brand\";v=\"8\", \"Chromium\";v=\"114\", \"Google Chrome\";v=\"114\"",
    "sec-ch-ua-mobile": "?0",
    "sec-ch-ua-platform": "\"Linux\"",
    "sec-fetch-dest": "script",
    "sec-fetch-mode": "no-cors",
    "sec-fetch-site": "same-site",
    "user-agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36"
}
cookies = {
    "dnk": "%5Cu5C0F%5Cu5C41%5Cu5B69%5Cu7684%5Cu540C%5Cu684C",
    "uc1": "cookie15=W5iHLLyFOGW7aA%3D%3D&cookie16=U%2BGCWk%2F74Mx5tgzv3dWpnhjPaQ%3D%3D&cookie14=UoYelQuZ6U7w8Q%3D%3D&cookie21=VT5L2FSpczFp&existShop=false&pas=0",
    "uc3": "id2=UU2w7HQAAFbIeg%3D%3D&nk2=sym05msnrMIM%2Blij&lg2=VFC%2FuZ9ayeYq2g%3D%3D&vt3=F8dD3CIcLLrHRHuO36E%3D",
    "tracknick": "%5Cu5C0F%5Cu5C41%5Cu5B69%5Cu7684%5Cu540C%5Cu684C",
    "lid": "%E5%B0%8F%E5%B1%81%E5%AD%A9%E7%9A%84%E5%90%8C%E6%A1%8C",
    "_l_g_": "Ug%3D%3D",
    "uc4": "id4=0%40U2%2F32UFCU5ox6sGzUmrmrwmuI4Zk&nk4=0%40sVYU%2FKupM8qEFZVeTIbI4YC6jIlttg8%3D",
    "unb": "2522193327",
    "lgc": "%5Cu5C0F%5Cu5C41%5Cu5B69%5Cu7684%5Cu540C%5Cu684C",
    "cookie1": "U%2BGVmID0OAiA12Bq8mf%2FJa6kyY6JnZhc%2FZkBXOTA6O4%3D",
    "login": "true",
    "cookie17": "UU2w7HQAAFbIeg%3D%3D",
    "cookie2": "1cf8cadef7bb5e351edbcaf0e512c60d",
    "_nk_": "%5Cu5C0F%5Cu5C41%5Cu5B69%5Cu7684%5Cu540C%5Cu684C",
    "sgcookie": "E100f8VLpb5GhZY1ICEVkAYGFGjS3Eafb2xXaxwuOuNoxsp4y%2FD7%2BI58pIIl2uCFlxbYa6%2Bmujeo20j8cQzMuw4ZXvCzJLv2RIJvbrcN1qV%2BQRdTBzQSNAxwWpcqg%2Bf6IEE0",
    "cancelledSubSites": "empty",
    "sg": "%E6%A1%8C76",
    "t": "5efb177f8fe091cdd6a83f27274baf24",
    "csg": "ceb89029",
    "_tb_token_": "f5e5e4b063a7e",
    "cna": "Sr63HVcZDRUCAXjo69LdzIfa",
    "xlly_s": "1",
    "x5sec": "7b22617365727665723b32223a226633366163363437646635646431633136666230326239363964336138663038434c323831366f47454e5749764966382f2f2f2f2f774561444449314d6a49784f544d7a4d6a63374d54443574345447416b4143222c22733b32223a2234346265396166363531323536353437227d",
    "_m_h5_tk": "097a4400f58edcfde450045094664cae_1700135633086",
    "_m_h5_tk_enc": "69dfa05517ae3dfca0cf14a1f15b6e55",
    "tfstk": "dz-wXktBRzEIwyfsyNjVYWdj0eIOxghSQn1fnKvcC1fiMABc0COhoo9sWxkVTIC15GY1noRCOIZXCn8L0LpvfAIjBGpODicSN0t2BdIxTeFWbf_tmKG0tbiSVd3GBi9nNAB9PgjZBnkzk4QiZLCHX2fV7UHQE1Z0mhmAS_P5s9B9Y8_ONdxw9B6NQSB3_Hxv7S4VS9BFNvkFDDY8t",
    "l": "fBOsidq4PihXcLAhBO5Zourza77O0QRfGsPzaNbMiIEGC6k1g8JTYxtQVqe06L-RR8XPMg8p4BtzD3ptZFr7-zDjFhIeV9cdvdKvQeTIK7Nk_",
    "isg": "BOzsK_GQpeqciLHWKCCnDoo1vcMepZBPImLrwEYvWBVqUYhbb7aY3uGncRlpWcin"
}
def get_comment(url = "https://h5api.m.tmall.com/h5/mtop.alibaba.review.list.for.new.pc.detail/1.0/"):


    params = {
        "jsv": "2.7.0",
        "appKey": "12574478",
        "t": "1700126928785",
        "sign": "4043a24c37df7f7cabf6c44c42a053e9",
        "api": "mtop.alibaba.review.list.for.new.pc.detail",
        "v": "1.0",
        "isSec": "0",
        "ecode": "0",
        "timeout": "10000",
        "ttid": "2022@taobao_litepc_9.17.0",
        "AntiFlood": "true",
        "AntiCreep": "true",
        "preventFallback": "true",
        "type": "jsonp",
        "dataType": "jsonp",
        "callback": "mtopjsonp7",
        "data": "{\"itemId\":\"649135812271\",\"bizCode\":\"ali.china.tmall\",\"channel\":\"pc_detail\",\"pageSize\":20,\"pageNum\":1}"
    }
    response = requests.get(url, headers=headers, cookies=cookies, params=params)

    print(response.text)
    print(response)
    return response.json()
def save_comment():
    for comment in [comment3,comment4,comment5,comment6,comment7,comment8,comment9,comment10]:
        reviewVOList = comment['data']['module']['reviewVOList']
        for data in reviewVOList:
            data["_id"] = data["id"]
            print(data['_id'])
            try:
                tmall_comment_test.insertOne(data)
            except Exception as e:
                print(e)

def save_csv():
    seeds = tmall_comment_test.findAll()
    lists =[]
    for seed in seeds:
        text = seed['reviewWordContent']
        id = seed["_id"]
        lists.append({'id':id,'text':text})

    pd.DataFrame(lists).to_csv("tmall_comment.csv",index=False,encoding="utf-8")


if __name__ == "__main__":
    print()
    # save_csv()

    data  = pd.read_csv('tmall_comment.csv')
    # print(data['text'])
    text = ''
    for t in data['text']:
        print(t)
        text +=t +'\n'
    words = jieba.cut(text)
    words_f= [word for word in words if len(word)> 1]
    words_count ={}
    for word in words_f:
        words_count[word] = words_count.get(word,0) + 1
    print(words_count)
    # 将字典转换为列表，并按值进行排序
    sorted_list = sorted(words_count.items(), key=lambda x: -x[1])

    # 创建有序字典，并将排序后的键值对逐个添加到其中
    sorted_dict = {}
    for item in sorted_list:
        sorted_dict[item[0]] = item[1]
    for k,v in sorted_dict.items():

        print(k,v)

